load("@rules_proto//proto:defs.bzl", "proto_library")
load("@io_bazel_rules_go//go:def.bzl", "go_library")
load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
load("//pkg/testutils:buildutil/buildutil.bzl", "disallowed_imports_test")

proto_library(
    name = "catenumpb_proto",
    srcs = [
        "encoded_datum.proto",
        "index.proto",
    ],
    strip_import_prefix = "/pkg",
    visibility = ["//visibility:public"],
    deps = ["@com_github_gogo_protobuf//gogoproto:gogo_proto"],
)

go_proto_library(
    name = "catenumpb_go_proto",
    compilers = ["//pkg/cmd/protoc-gen-gogoroach:protoc-gen-gogoroach_compiler"],
    importpath = "github.com/cockroachdb/cockroach/pkg/sql/catalog/catenumpb",
    proto = ":catenumpb_proto",
    visibility = ["//visibility:public"],
    deps = [
        "@com_github_gogo_protobuf//gogoproto",
    ],
)

go_library(
    name = "catenumpb",
    srcs = [
        "doc.go",
        "structured.go",
    ],
    embed = [":catenumpb_go_proto"],
    importpath = "github.com/cockroachdb/cockroach/pkg/sql/catalog/catenumpb",
    visibility = ["//visibility:public"],
)

disallowed_imports_test(
    src = "catenumpb",
    disallowed_list = [
        "//pkg/sql/sem/tree",
    ],
)
